package main

import (
	"fmt"
	"strings"
	"time"
)

func main() {
	// 通过In()函数改变时区
	fmt.Println(time.Now())
	var cstsh, _ = time.LoadLocation("Asia/Shanghai")
	fmt.Println("SH: ", time.Now().In(cstsh).Format("2016-01-02 15:04:05"))
	fmt.Println(time.Now().In(cstsh))
	fmt.Println(time.Now())

	var cstZone = time.FixedZone("CST", 8*3600) // 东八
	fmt.Println("SH : ", time.Now().In(cstZone).Format("2006-01-02 15:04:05"))

	api := getApiserver([]string{"afdasf", "dfsaf", "dsfas"})
	fmt.Println(api)
}

func getApiserver(hosts []string) (apiserver string) {
	for _, host := range hosts {
		apiserver += "https://" + host + ":6443,"
	}
	return strings.TrimRight(apiserver, ",")
}
